package com.java01;

import java.util.Scanner;

public class ninthjava {
    public static void main(String[] args) {
        int count = 0;
        for (;;){
            double a = Math.random();
            System.out.println((int) (a*100)+1);
            count++;
            if ((int) (a*100)+1 == 97){
                break;
            }
        }
        System.out.println("abc"+count);
    }
}

class break01{
    public static void main(String[] args) {
        int sum = 0;
        for (int i = 1;i<=100;i++){
            sum += i;
            if (sum > 20){
                System.out.println(i);
                break;
            }
        }
    }
}

class break02{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = 3;
        for (int i = 1;i<=3;i++) {
            System.out.println("请输入用户名：");
            String uname = scanner.next();
            System.out.println("请输入密码：");
            String password = scanner.next();
            if ("丁真".equals(uname) && "666".equals(password)) {
                System.out.println("登陆成功！");
                break;
            } else {
                x--;
                System.out.println("用户名或密码错误，还有" + x + "次机会");
            }
        }
    }
}

class contiueexercise01{
    public static void main(String[] args) {
        double sum = 100000;
        int i = 0;
        while (true){
            if (sum > 50000){
                sum *= 0.95;
                i++;
            }else if (sum<=50000&&sum>=1000){
                    sum -= 1000;
                    i++;
                }else {
                    break;
                }

            System.out.println("sum="+sum);
        }
        System.out.println("可以经过"+i+"次路口");
    }
}
class homework02{
    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个三位数整数：");
        for (int i = 100;i<=999;i++) {
            int a = i / 100, b = i % 100 / 10, c = i % 10;
            if (a * a * a + b * b * b + c * c * c == i) {
                System.out.println(i+"是水仙花树");
            }
        }
    }
}
class homework03{
    public static void main(String[] args) {
        for (int i = 1,j=0;i<=100;i++){
            if (i%5!=0){
                j++;
                System.out.print(i+"\t");
                if (j%5==0){
                    System.out.println();
                }
            }
        }
    }
}

class homework04{
    public static void main(String[] args) {
        for (char a = 'a';a<='z';a++){
            System.out.print(a+",");
        }
        System.out.println();
        for (char a = 'Z';a>='A';a--){
            System.out.print(a+",");
        }
    }
}
class homework05{
    public static void main(String[] args) {
        double sum = 0;
        for (int i = 1;i<=100;i++){
            if (i%2==0){
                sum -= 1.0/i;
            }else {
                sum += 1.0/i;
            }
        }
        System.out.println(sum);
    }
}
class homework06{
    public static void main(String[] args) {
        int sum = 0;
        for (int i =1;i<=100;i++){
            for (int j = 1;j<=i;j++){
                sum += j;
            }
        }
        System.out.println(sum);
    }
}